/**
 *
 * @file
 *		heap_av
 *
 * @brief
 *		Heap implementation by anyav
 */

#include <stdlib.h>
#include <stdio.h>
#include "../../api/heap.h"
#include "heap_av.h"

#define Err printf

#ifdef _DEBUG
#define Dbg printf
#else
#define Dbg
#endif


heap_av::~heap_av() 
{ 
	if( alloc_sz ) 
		Err("[heap] destruct not empty %p", alloc_sz ); 
}
void* heap_av::alloc( size_t sz, unsigned int tag )
{ 
	if( ( alloc_sz + sz ) > total_limit )
	{
		Err("[heap] failed to alloc {sz=%p, tg=0x%x} sz=%p, total=%p",
			sz, tag, alloc_sz, total_limit );
		return NULL;
	}

	alloc_sz += sz;
	return NULL;
}





